﻿<?php

  include ('../raspored/common/config.php');
  $dsn = 'mysql:dbname='.$db_name.';host='.$server.';port=3306;charset=utf8';
try {
      $dbh = new PDO($dsn, $user, $pass);
}
catch (PDOException $e) {
      die('Konekcija neuspješna: ' . $e->getMessage(  ));
}
$dbh->query('SET CHARACTER SET utf8');
$id = $_POST['id'];
	
if($id == 0)  {
  	echo '{
    "success":false,
    "msg":"PHP poruka: Vozac_ID ne može biti nula"}';
  } 
 else {
  	
	$upit="CALL vozac_brisi('$id', @status);";
    $sth = $dbh->query($upit);
    if ($dbh->errorCode() <> '00000') {
      die("Error: ".implode(': ',$dbh->errorInfo(  ))."\n");
    }
	
		
  	echo '{
    "success":true,
    "msg":"PHP poruka: Podatak uspješno izbrisan."}';
	
  }
?>